<?php

session_start();

require($_SESSION['global']['darmedicus_local_patch']."/library/config.inc.php");
require($_SESSION['global']['darmedicus_local_patch']."/library/Database.singleton.php");
// create the $db singleton object
$db = Database::obtain(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);
$db->debug = true;
$db->connect();


$sql="SELECT * FROM wizyty_inf_dod WHERE id_wizyty = ".$_GET['id_wiz'];
    $row = $db->query_first($sql);
    
    // if user exists
    $data['nr_zlecenia']=$_GET['nr_zlecenia'];
    if(!empty($row['id_wizyty'])){
        
        $db->update("wizyty_inf_dod", $data, 'id_wizyty='.$_GET['id_wiz']);
    }
    else {
        $data['id_wizyty']=$_GET['id_wiz'];
        $db->insert('wizyty_inf_dod', $data);
    }

#$db->update("news", $data);
?>
